package com.webvihar.common.builders;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

import java.util.Vector;

public class SerializerDeserializerInclusionStrategy implements ExclusionStrategy {

    private Vector<String> vString;
    private Class<?> typeToSkip;
    
    public SerializerDeserializerInclusionStrategy(Vector<String> vString_) {
        super();
        vString = vString_;
    }
    
    public SerializerDeserializerInclusionStrategy(Class<?> skipClass) {
        super();
        typeToSkip = skipClass;
    }
    
    @Override
    public boolean shouldSkipClass(Class<?> clazz) {
        return (clazz == typeToSkip);
    }

    @Override
    public boolean shouldSkipField(FieldAttributes arg0) {
        if (vString.contains(arg0.getName())) {
            return true;
        } else {
            return false;
        }
    }

}
